﻿<UserControl x:Class="Mnk.Library.WpfControls.Dialogs.PerfomanceCounters.SelectPerfomanceCounters"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:loc="clr-namespace:Mnk.Library.WpfControls.Localization"
             xmlns:perfomanceCounters="clr-namespace:Mnk.Library.WpfControls.Dialogs.PerfomanceCounters"
             mc:Ignorable="d"  >
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="4*"/>
            <RowDefinition Height="5"/>
            <RowDefinition Height="*"/>
            <RowDefinition Height="40"/>
        </Grid.RowDefinitions>
        <DockPanel>
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" MinWidth="128" />
                    <ColumnDefinition Width="5"/>
                    <ColumnDefinition Width="2*" MinWidth="128"/>
                </Grid.ColumnDefinitions>
                <GroupBox Header="{loc:Tr AvailableCounters}">
                    <DockPanel Margin="5">
                        <Button Name="btnAdd" Content="{loc:Tr Add}" Width="64" Margin="20,5" DockPanel.Dock="Bottom" Click="AddClick" IsEnabled="False" HorizontalAlignment="Right"/>
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="2*" MinHeight="64"/>
                                <RowDefinition Height="5"/>
                                <RowDefinition Height="*" MinHeight="64"/>
                            </Grid.RowDefinitions>
                            <TreeView Name="Counters" SelectedItemChanged="OnSelectedCounter">
                                <TreeView.Resources>
                                    <HierarchicalDataTemplate DataType="{x:Type perfomanceCounters:Entity}" ItemsSource="{Binding Path=Children}" >
                                        <TextBlock Text="{Binding Path=Title}" ToolTip="{Binding Path=ToolTip}" />
                                    </HierarchicalDataTemplate>
                                </TreeView.Resources>
                            </TreeView>
                            <GridSplitter HorizontalAlignment="Stretch" Grid.Row="1"/>
                            <DockPanel Grid.Row="2">
                                <Label Padding="5,0" Content="{loc:Tr InstancesOfTheSelected}" DockPanel.Dock="Top"/>
                                <ListBox Name="Instances" SelectionMode="Extended" AlternationCount="2"/>
                            </DockPanel>
                        </Grid>
                    </DockPanel>
                </GroupBox>
                <GridSplitter VerticalAlignment="Stretch" HorizontalAlignment="Stretch" ResizeDirection="Columns" Grid.Column="1"/>
                <GroupBox Header="{loc:Tr AddedCounters}" Grid.Column="2" >
                    <DockPanel Margin="5">
                        <Button Name="btnRemove" Content="{loc:Tr Remove}" Width="64" Margin="20,5" DockPanel.Dock="Bottom" Click="RemoveClick" IsEnabled="False" HorizontalAlignment="Left"/>
                        <ListView Name="AddedCounters" SelectionChanged="AddedCounters_OnSelectedItemChanged" SelectionMode="Extended" AlternationCount="2">
                            <ListView.View>
                                <GridView>
                                    <GridViewColumn Header="{loc:Tr Category}" Width="140" DisplayMemberBinding="{Binding Category}"/>
                                    <GridViewColumn Header="{loc:Tr Name}" Width="200" DisplayMemberBinding="{Binding Name}" />
                                    <GridViewColumn Header="{loc:Tr Instance}" Width="120" DisplayMemberBinding="{Binding Instance}" />
                                </GridView>
                            </ListView.View>
                        </ListView>
                    </DockPanel>
                </GroupBox>
            </Grid>
        </DockPanel>
        <GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" />
        <TextBox Grid.Row="2"  Name="Info" IsReadOnly="True" TextWrapping="Wrap" VerticalScrollBarVisibility="Auto" Margin="5,0"/>
        <Button Content="{loc:Tr Refresh}" Padding="10,0" Margin="5" Click="RefreshClick" Grid.Row="4" HorizontalAlignment="Right" VerticalAlignment="Center"/>
    </Grid>
</UserControl>
